package com.yuanluludev.gaode

import android.content.Intent
import com.yuanluludev.gaode.service.LocationService
import com.yuanluludev.lib_utils.util.ServiceUtils
import com.yuanluludev.lib_utils.util.Utils

/**
 * yuanLulu
 * 高德地图 前后台持续定位
 */
object GaodeLoc {

    /**
     * 开始定位
     */
    internal fun startLoc() {
        if ((!(ServiceUtils.isServiceRunning(LocationService::class.java.name)))
            || (LocationService.latestLocation == null)
            || (LocationService.latestLocation?.errorCode != 0)) {
            Utils.getApp()?.startService(Intent(Utils.getApp(), LocationService::class.java))
        }
    }

}